<?php
if(!defined('ADMIN')){
	exit('Access Denied');
}


$page = !($_POST['pageNum'])?'1':intval($_POST['pageNum']);
$pagesize= !($_POST['numPerPage'])?'20':intval($_POST['numPerPage']);


if(empty($pagesize)){
    $pagesize=20;
}
$frmnum=($page-1)*$pagesize;
$orderField=trim($_POST["orderField"]);
$orderDirection=trim($_POST["orderDirection"]);
if(empty($orderField)){
    $orderField="id";
}
if(empty($orderDirection)){
    $orderDirection="desc";
}
if($orderField<>""){
    $order=" order by $orderField ".$orderDirection;
}else{
    $order=" order by id desc";
}

$q=trim($_POST['q']);
$zjstatus=intval($_REQUEST["zjstatus"]);
if($zjstatus==0){
    $where='status=2 and parentid=0 and zjstatus=2  and ddstatus in (0,1)';
}else{
    $where='status=2 and parentid=0 and zjstatus=2 and ddstatus='.$zjstatus;
}
if($q<>""){
    
    $where.=" and code_numb like '%".$q."%'";
}

$total=$ezhand->count("workman",$where);
$row=$ezhand->select_all("workman",'*',''.$where.' '.$order.' limit '.$frmnum.','.$pagesize);

?>